<template>
  <div id="app">
    <div id="app" style="width: 400px">
      <el-form ref="form" :model="params" label-width="80px" v-loading="listLoading" class="el-form-css">
        <el-form-item label="企业名称:">
          <el-input v-model="params.companyName" placeholder="请输入企业名称"></el-input>
        </el-form-item>
        <el-form-item label="营业执照:">
          <el-input v-model="params.registeredNumber" placeholder="请输入营业执照号码        (需审核项)"></el-input>

        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="onSubmit()">立即修改</el-button>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <el-tag type="info" v-if="params.auditStatus===0">未审核</el-tag>
          <el-tag type="warning" v-if="params.auditStatus===1">审核中</el-tag>
          <el-tag type="error" v-if="params.auditStatus===2">审核失败</el-tag>
          <el-tag type="success" v-if="params.auditStatus===3">审核通过</el-tag>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import {getCompanyDetail, postCompanyInformation} from "@/api";

export default {
  name: "comAuditInformation",
  data() {
    return {
      listLoading: false,
      params: {
        id:'',
        companyName: '',
        registeredNumber: '',
        auditStatus: ''
      },
    }
  },
  methods: {
    init() {
      this.listLoading = true
      getCompanyDetail(this.$route.query.id).then(res => {
        this.params = {}
        this.$set(this.params, 'id', res.data.id)
        this.$set(this.params, 'companyName', res.data.companyName)
        this.$set(this.params, 'registeredNumber', res.data.registeredNumber)
        this.$set(this.params, 'auditStatus', res.data.auditStatus)
        this.listLoading = false
      })
    },
    onSubmit() {
      postCompanyInformation(this.params).then(res => {
        this.$message.success('修改成功！')
        this.init()
        return res
      })
    }
  },
  created() {
    this.init()
  }, mounted() {
    window.app = this
  }
}
</script>

<style scoped>

.el-form-css .el-input, .el-select {
  width: 300px;
}

</style>